#ifndef RENDER_UTIL_H
#define RENDER_UTIL_H

#include "interface.h"
#include <stdint.h>

#define SPRITE_BONUSES 0
#define SPRITE_FRIGHTENED_GHOST 28
#define SPRITE_GHOST 32
#define SPRITE_PTS 40
#define SPRITE_PACMAN 44
#define SPRITE_PACMAN_DEATH 52

typedef struct {
    GameInterface* interface;

    uint8_t cur_sprite;
    int flip_x;
    int flip_y;
    uint8_t palette;
} DisplayUtilState;

/// Initialize this frame
extern void display_init(DisplayUtilState* state, GameInterface* interface);

/// Displays text onto the tilemap
extern void display_text(DisplayUtilState* state, int x, int y, const char* fmt, ...);

/// Clear the display tilemap
extern void clear_display(DisplayUtilState* state);

/// Clear a row on the tilemap
extern void display_clear_row(DisplayUtilState* state, int row);

/// Clear a rectangle of tiles
extern void display_clear_rect(DisplayUtilState* state, int x, int y, int w, int h);

/// Display a sprite on screen. Returns a non-zero value if
/// the display ran out of sprite slots.
extern int display_sprite(DisplayUtilState* state, int x, int y, int sprite);

#endif